<template>
  <div>
    <ul class="nav">
      <li>
        商品
        <span></span>
      </li>
      <li>
        评价
        <span></span>
      </li>
      <li>
        详情
        <span></span>
      </li>
      <li>
        推荐
        <span></span>
      </li>
    </ul>
    <div class="content1">
      <img :src="$pre+obj.img" alt />
      <ul>
        <li class="clearfix">
          <div class="fl">
            <span>￥{{obj.price}}</span>
            <span>￥{{obj.market_price}}</span>
          </div>
          <div class="fr">
            <img src="../../../assets/img/img/商品详情 (2).png" alt />
            <p>收藏</p>
          </div>
        </li>
        <li>{{obj.goodsname}}</li>
        <li>余量：{{obj.number}}</li>
        <li>
          <p>颜色：{{obj.specsattr}}</p>
        </li>
        <li>
          <p>
            <span>此商品2020-11-11 00点结束闪购特卖，品牌美妆闪购专场</span>
            <a href class="fr">查看></a>
          </p>
        </li>
      </ul>
    </div>
    <div class="content2">
      <table>
        <tr>
          <td>领券</td>
          <td colspan="clearfix">
            <img src="../../../assets/img/img/商品详情 (4).png" alt class="fl" />
            <img src="../../../assets/img/img/商品详情 (5).png" alt class="fl" />
            <img src="../../../assets/img/img/商品详情 (6).png" alt class="fl" />
          </td>
        </tr>
        <tr>
          <td>分期</td>
          <td>可选3/6/12期</td>
          <td>
            <img src="../../../assets/img/img/商品详情 (7).png" alt />
          </td>
        </tr>
      </table>
    </div>
    <ul class="content3">
      <li>
        <img src="../../../assets/img/img/商品详情 (8).png" alt />
        <p>客服</p>
      </li>
      <li>
        <img src="../../../assets/img/img/商品详情 (8).png" alt />
        <p>店铺</p>
      </li>
      <li @click="goshop">
        <img src="../../../assets/img/img/商品详情 (9).png" alt />
        <p>购物车</p>
      </li>
      <li @click="addshop">
        <input type="button" value="加入购物车" />
      </li>
      <li>
        <input type="button" value="立即购买" />
      </li>
    </ul>
  </div>
</template>

<script>
import { reqDetail, reqAdd } from "../../../http/api.js";
export default {
  data() {
    return {
      obj: {}
    };
  },
  mounted() {
    reqDetail({ id: this.$route.query.id }).then(res => {
      this.obj = res.data.list[0];
    });
  },
  methods: {
    goshop(){
      this.$router.push("/index/shop")
    },
    addshop() {
      reqAdd({
        uid:JSON.parse(localStorage.getItem("user")).uid,
        goodsid:this.$route.query.id,
        num:1,
        authorization:JSON.parse(localStorage.getItem("user")).token,
      });
    }
  }
};
</script>

<style scoped>
body {
  background: #f2f2f2;
}
.nav {
  font-size: 0.26rem;
  height: 0.56rem;
  color: white;
  background: linear-gradient(to bottom, #ff7a68, #ff8a7f);
  display: flex;
  flex-direction: row;
  justify-content: space-around;
  align-items: center;
  line-height: 0.51rem;
  position: relative;
  overflow: hidden;
  box-shadow: 0px 4px 4px #ffd7d0;
}
.nav li:hover span {
  width: 0.4rem;
  height: 0.05rem;
  border-radius: 1px;
  background: white;
  display: block;
  margin: 0 auto;
}
.nav li:hover {
  font-weight: bolder;
  font-size: 0.3rem;
}
.nav li:nth-of-type(3) img {
  width: 0.13rem;
  height: 0.26rem;
  float: right;
  margin: 6px 0 0 6px;
}
.nav li:nth-of-type(6) {
  box-shadow: -5px 0 8px #f56557;
  line-height: 0.56rem;
  display: flex;
}
.nav li:nth-of-type(6) img {
  width: 0.24rem;
  height: 0.26rem;
  margin: 8px 8px 0;
}
.content1 {
  background: white;
}
.content1 img {
  width: 7.5rem;
  height: 7.5rem;
}
.content1 ul {
  padding: 0 0.2rem;
}
.content1 ul li:nth-of-type(2) {
  font-size: 0.3rem;
  font-weight: bolder;
  line-height: 0.4rem;
}
.content1 ul .fl span:nth-of-type(1) {
  font-size: 0.4rem;
  font-weight: bolder;
  color: #ff775b;
  padding-right: 0.1rem;
  line-height: 0.6rem;
}
.content1 ul .fl span:nth-of-type(2) {
  font-size: 0.12rem;
  color: gray;
  text-decoration: line-through;
}
.content1 ul div:nth-of-type(2) {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}
.content1 ul div:nth-of-type(2) img {
  width: 0.22rem;
  height: 0.21rem;
  margin-bottom: 0.06rem;
}
.content1 ul div:nth-of-type(2) p {
  color: #ff8066;
}
.content1 ul li:nth-of-type(3) {
  font-size: 0.24rem;
  color: gray;
  line-height: 0.4rem;
}
.content1 ul li:nth-of-type(4) p {
  font-size: 0.2rem;
  line-height: 0.32rem;
  margin: 0.1rem 0;
}
.content1 ul li:nth-of-type(5) {
  font-size: 0.12rem;
  color: gray;
  padding: 0.1rem 0;
}
.content1 ul li:nth-of-type(5) p {
  line-height: 0.4rem;
  background-color: #f2f2f2;
  border-radius: 0.08rem;
}
.content1 ul li:nth-of-type(5) a {
  color: #ff8066;
}
.content2 {
  background: white;
  width: 100%;
  height: 1.6rem;
  overflow: hidden;
}
.content2 table {
  width: 100%;
}
.content2 tr {
  height: 0.9rem;
  line-height: 0.9rem;
}
.content2 td:nth-of-type(1) {
  width: 0.9rem;
  font-size: 0.24rem;
  font-weight: bolder;
  padding-left: 0.2rem;
}
.content2 td:nth-of-type(2) {
  color: gray;
  font-size: 0.24rem;
  border-bottom: 1px solid rgba(223, 223, 223, 0.904);
}
.content2 td:nth-of-type(2) img {
  width: 0.78rem;
  height: 0.32rem;
  margin-right: 0.2rem;
}
.content2 td:nth-of-type(3) {
  width: 0.1rem;
  padding-right: 0.2rem;
}
.content2 td:nth-of-type(3) img {
  width: 0.08rem;
  height: 0.18rem;
}
.content3 {
  background: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid rgba(223, 223, 223, 0.904);
}
.content3 img {
  width: 0.4rem;
  height: 0.4rem;
}
.content3 li {
  height: 0.98rem;
}
.content3 p {
  color: gray;
  font-size: 0.18rem;
  margin-top: 0.08rem;
}
.content3 li:nth-of-type(1),
.content3 li:nth-of-type(2),
.content3 li:nth-of-type(3) {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}
.content3 li:nth-of-type(4),
.content3 li:nth-of-type(5) {
  flex-grow: 0;
}
.content3 li:nth-of-type(4) input {
  width: 2.2rem;
  height: 0.98rem;
  background: #ffcc66;
  color: #663014;
}
.content3 li:nth-of-type(5) input {
  width: 2.2rem;
  height: 0.98rem;
  background: #ff6040;
  color: white;
}
</style>